#ifndef USERHANDLE_H
#define USERHANDLE_H

#include <QObject>
#include "components/opencv_camera/opencv_camera.h"
#include "components/image_provider/myimageprovider.h"
#include "components/directshow/mydirectshow.h"
#include "components/file/file.h"

class userHandle : public QObject
{
    Q_OBJECT
public:
    explicit userHandle(QObject *parent = nullptr);

    MyImageProvider* getImageProvider();

    Q_INVOKABLE bool openCamera(int devID);
    Q_INVOKABLE void closeCamera();
    Q_INVOKABLE QStringList getCameraNameList();

    Q_INVOKABLE QStringList getDirEntryList(QString path);
    Q_INVOKABLE bool openRootFileDir();
    Q_INVOKABLE bool saveCSVFile();
    Q_INVOKABLE bool openPictureFile();
    Q_INVOKABLE bool openPhotoFileDir();
    Q_INVOKABLE bool savePhotoFile(QString path);
    Q_INVOKABLE bool openRetreatmentFileDir();
    Q_INVOKABLE bool checkPicture_face(QString path);
    Q_INVOKABLE bool retreatmentPicture(QString readPath, QString savePath);
    Q_INVOKABLE bool retreatmentPictureAll(QString readPath, QString savePath, QStringList pictureList);
    Q_INVOKABLE QSize getPictureSize(QString path);
    Q_INVOKABLE bool saveRecognizerFile(QString csvPath, QString savePath, QString fileName, int mode);
    Q_INVOKABLE bool openCSVFile();
    Q_INVOKABLE bool openRecognizerFileDir();
    Q_INVOKABLE bool openRecognizerFile();
    Q_INVOKABLE bool setFaceRecognizer(QString path, int mode);
    Q_INVOKABLE void warningWindow(QString title, QString text);

signals:
    void pictureOpened(QString filePath, QStringList fileList);
    void checkPictureOvered(int faceNum);
    void rootFileDirectoryOpened(QString filePath, QStringList fileList);
    void photoFileDirectoryOpened(QString filePath);
    void retreatmentDirectoryOpened(QString filePath);
    void resizeAllPictureOvered(void);
    void csvFileDirectoryOpened(QString filePath);
    void recognizerDirectoryOpened(QString filePath);
    void xmlFileDirectoryOpened(QString filePath);

private:
    MyImageProvider *m_imgPv;
    opencv_camera *m_camera;
    mydirectshow *m_directshow;
    file *m_file;
};

#endif // USERHANDLE_H
